//
//  baseViewController.m
//  嘀嘀拍
//
//  Created by wangjia_01 on 16/3/2.
//  Copyright © 2016年 wangjia_01. All rights reserved.
//

#import "baseViewController.h"
#import "LSTabBarViewController.h"

@interface baseViewController ()

@end

@implementation baseViewController


- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.navigationController.navigationBar.hidden=YES;
    self.hidesBottomBarWhenPushed=YES;
    self.tabBarController.tabBar.hidden=YES;
    
    // self.navigationController.fd_fullscreenPopGestureRecognizer.enabled=YES;
    self.hidesBottomBarWhenPushed=YES;
    self.tabBarController.tabBar.hidden=YES;
    self.navigationController.navigationBarHidden=YES;
    // self.navigationController.fd_prefersNavigationBarHidden=YES;
    
    //    if (IOS6_OR_LATER) {
    if (self.navigationController.viewControllers.count<=1) {
        
        LSTabBarViewController *tabBarCtrl = (LSTabBarViewController *)self.tabBarController;
        
        CGFloat i =0.2f;
        //        if ([[LSRequestObj defaultHelper]isNoAnimation]) {
        //            i = 0.0;
        //        }else {
        //            i = 0.2f;
        //        }
        //        DLog(@"%f",i);
        [UIView animateWithDuration:i
                         animations:^{
                             [tabBarCtrl.tabbarView setFrame:CGRectMake(0, tabBarCtrl.tabbarView.frame.origin.y, tabBarCtrl.tabbarView.frame.size.width, tabBarCtrl.tabbarView.frame.size.height)];
                         }];
    }
    


}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    
    //    if (IOS6_OR_LATER) {
    if (self.navigationController.viewControllers.count>1) {
        LSTabBarViewController *tabBarCtrl = (LSTabBarViewController *)self.tabBarController;
        // [LSRequestObj defaultHelper].isNoAnimation = NO;
        [UIView animateWithDuration:0.25 animations:^{
            [tabBarCtrl.tabbarView setFrame:CGRectMake(-tabBarCtrl.tabbarView.frame.size.width, tabBarCtrl.tabbarView.frame.origin.y, tabBarCtrl.tabbarView.frame.size.width, tabBarCtrl.tabbarView.frame.size.height)];
        }];
    }
    //    }
}

- (IBAction)goBack:(id )sender
{
    
    [self .navigationController popViewControllerAnimated:YES];
    
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
